import { BrowserRouter, useRoutes } from 'react-router-dom'

import Board from './pages/Board'
import Article from './pages/Article'
import Layout from './Layout'
import NotFound from './pages/NotFound'

const routesList = [
	{
		path: '/',
		element: <Layout />,
		children: [
			{
				index: true,
				element: <Board />
			},
			{
				path: 'article',
				element: <Article />
			}
		]
	},
	{
		path: '*',
		element: <NotFound />
	}
]

function WrapperRoutes() {
	return useRoutes(routesList)
}

function App() {
	return (
		<>
			<BrowserRouter>
				<WrapperRoutes />
			</BrowserRouter>
		</>
	)
}

export default App
